#!/bin/bash

checkout=0

while [ "$1" != "" ]; do
  if [ $1 == "-c" ] || [ $1 == "--checkout" ]; then
    checkout=1
    break
  fi
  shift
done

if [ $checkout == "1" ]; then
  git submodule foreach --recursive git checkout -- ./
fi

git submodule foreach --recursive git pull origin -p